package com.kizitonwose.calendarview.utils;

import com.kizitonwose.calendarview.NumberRange;

import java.util.Arrays;

/**
 * @author LiuQingHua
 * @version 1.0
 * @date 2021/2/22/022 14:33
 */
public class ArrayExtension<T> {
    private T[] arrays;

    public ArrayExtension(T[] arrays) {
        this.arrays = arrays;
    }

    public static <T> ArrayExtension<T> getInstance(T[] arrays) {
        return new ArrayExtension<>(arrays);
    }


    public T[] sliceArray(NumberRange range) {
        return Arrays.copyOfRange(arrays, range.getStart().intValue(), range.getEndInclusive().intValue());
    }
}
